package com.android.delivery.entity

import android.os.Parcelable
import com.android.delivery.entity.request.OrderReq
import kotlinx.android.parcel.Parcelize

/**
 * @author: mqwang
 * @create: 2/24/21 4:01 PM
 * @Description:
 */
@Parcelize
data class Logistics(

        var discountFee: Double = 0.0,
        var estimatedTotalFee: Double = 0.0,
        var estimatedWeight: Int = 0,
        var goodsInfo: String = "",
        var logisticsNo: String = "",
        var payChannel: Int = 0,
        var payTime: String? = "",
        var payType: Int = 0,
        var type: Int = 1,//订单类型，1：速配，2：零担
        var payment: Double = 0.0,
        var pickUpEndTime: String? = "",
        var pickUpStartTime: String? = "",
        var pickUpType: Int? = 0,
        var printed: Boolean = false,
        var receiverAdcode: String? = "",
        var receiverAddress: String = "",
        var receiverInfo: Addr? = null,
        var receiverCity: String? = "",
        var receiverDistrict: String? = "",
        var receiverLatitude: Double = 0.0,
        var receiverLongitude: Double = 0.0,
        var receiverMobile: String = "",
        var receiverName: String = "",
        var receiverProvince: String? = "",
        var receiverStreet: String? = "",
        var senderAdcode: String? = "",
        var senderAddress: String = "",
        var senderInfo: Addr?,
        var senderCity: String? = "",
        var senderDistrict: String? = "",
        var senderLatitude: Double = 0.0,
        var senderLongitude: Double = 0.0,
        var senderMobile: String = "",
        var senderName: String = "",
        var senderProvince: String? = "",
        var senderStreet: String? = "",
        var state: Int = 0,
        var totalFee: Double = 0.0,
        var userId: Int = 0,
        var userLevel: Int = 0,
        var weight: Int = 0,

        //是否选中
        var isSelect: Boolean = false,
        var createdTime: Long = 0,

        //订单备注
        var userMemo: String? = "",

        //超重费用
        var excessWeightFee: Double = 0.0,

        //
        var sourceUserId: String? = "",

        //件数
        var quantity: Int = 0,

        //是否已支付
        var paid: Boolean = false

) : BaseEntity<Logistics>(), Parcelable {

    fun getLogictReq(): OrderReq {
        var logisticsOrderReq = OrderReq()
        logisticsOrderReq.logisticsNo = logisticsNo
        logisticsOrderReq.senderAddress = senderInfo
        logisticsOrderReq.receiverAddress = receiverInfo
        logisticsOrderReq.payType = payType
        logisticsOrderReq.goodsInfo = goodsInfo
        logisticsOrderReq.userMemo = userMemo
        logisticsOrderReq.excessWeightFee = excessWeightFee
        return logisticsOrderReq
    }

    fun getReceAddr(): Addr {
        var addr = Addr()
        addr.latitude = receiverLatitude
        addr.longitude = receiverLongitude
        addr.address = receiverAddress
        return addr
    }

    fun getSendAddr(): Addr {
        var addr = Addr()
        addr.latitude = senderLatitude
        addr.longitude = senderLongitude
        addr.address = senderAddress
        return addr
    }
}